//
//  UIView+MOCorner.m
//  MOPrefix
//
//  Created by WCImApp on 2020/6/22.
//

#import "UIView+MOCorner.h"
#import "MOCornerRadiusTool.h"
@implementation UIView (MOCorner)

- (void)defaultMessageSendLayer{
    CGFloat radiusValue = 4;
    [self makeCornerLayerTopLeft:radiusValue topRight:4 bottomLeft:radiusValue bottomRight:radiusValue];
}

- (void)defaultMessageReciveLayer{
    CGFloat radiusValue = 4;
    [self makeCornerLayerTopLeft:4 topRight:radiusValue bottomLeft:radiusValue bottomRight:radiusValue];
}

- (void)makeCornerLayerTopLeft:(CGFloat)topLeft topRight:(CGFloat)topRight bottomLeft:(CGFloat)bottomLeft bottomRight:(CGFloat)bottomRight{
    CAShapeLayer *shapeLayer = [CAShapeLayer layer];
     CornerRadii cornerRadii = CornerRadiiMake(topLeft, topRight, bottomLeft, bottomRight);
    CGPathRef path = MOPathCreateWithRoundedRect(self.bounds,cornerRadii);
    shapeLayer.path = path;
    CGPathRelease(path);
    self.layer.mask = shapeLayer;
}
@end
